<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>气度网 - 气度如水</title>
    <link type="text/css" rel="stylesheet" href="${ctx}/css/public_production.css" >
    <link rel="stylesheet" href="${ctx}/js/editor/jquery.wysiwyg.css" type="text/css"/> 
	<link rel="stylesheet" href="${ctx}/js/editor/help/lib/ui/jquery.ui.all.css" type="text/css"/> 
	<link rel="stylesheet" href="${ctx}/js/editor/help/lib/ui/jquery.ui.dialog.css" type="text/css"/> 
	<link rel="stylesheet" href="${ctx}/js/editor/help/lib/blueprint/ie.css" type="text/css" media="screen, projection" />
    <script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${ctx}/js/editor/help/lib/jquery.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/jquery.wysiwyg.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/help/lib/ui/jquery.ui.core.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/help/lib/ui/jquery.ui.widget.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/help/lib/ui/jquery.ui.position.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/help/lib/ui/jquery.ui.dialog.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/controls/wysiwyg.image.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/controls/wysiwyg.table.js"></script> 
	<script type="text/javascript" src="${ctx}/js/editor/controls/wysiwyg.link.js"></script>
	<script type="text/javascript" src="${ctx}/js/area.js"></script>
	<script type="text/javascript"> 
    (function($) {
        $(document).ready(function() {
            $('#detail').wysiwyg({
                autoload: false,
                controls: {
                "html": {visible: true}
                }
            });
        });  
    })(jQuery);
	function inputBrand(id1,id2){
		$('#' + id1).attr('disabled','disabled');
		$('#' + id2).removeAttr('disabled');
	};
    </script>
</head>

<body>
	<s:if test=" urlMark == 1">
		<form action="${ctx}/my/publicProduct" method="post" enctype ="multipart/form-data">
	<div class="container">
		<div class="title">
        	<div class="ctrl">发布产品信息</div>
        </div> 
        <div class="info">
        	<li>
				<div class="detail_1">产品标题</div>
                <div class="detail_2">
                	<input id="product_name" maxlength="32" name="productDTO.prodName"  /><font color="#FF0000">* 标题不超过32个字</font>
                </div>
            </li>
        	<li class="summary">
				<div class="detail_1">产品简要描述</div>
                <div class="detail_2">
                	<textarea id="summary" name="productDTO.summary"></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
        	<li class="guige">
				<div class="detail_1">产品规格描述</div>
                <div class="detail_2">
                	<textarea id="guige" name="productDTO.standardDesc"></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
        	<li>
				<div class="detail_1">品牌名称</div>
                <div class="detail_2">
                	<input id="brand_change" name="brand" checked  type="radio" onClick="inputBrand('brand_2','brand_1')"/>从列表中选择：
                	<select id="brand_1" name="productDTO.brand" >
                		<s:iterator value="brandList" var="brand">
                			<option value="" selected></option>
                    		<option value="<s:property value="#brand.typeCode"/>"><s:property value="#brand.typeName"/></option>
                    	</s:iterator>
                    </select>
                    <input type="radio" name="brand"  onClick="inputBrand('brand_1','brand_2')"/>其他：
                	<input id="brand_2" name="productDTO.brand" disabled maxlength="10"/> <font color="#FF0000">* 品牌名称不超过10个字</font>
                </div>
            </li>            
        	<li>
				<div class="detail_1">总量</div>
                <div class="detail_2">
                	<input id="amount" name="productDTO.amount" />
                    <font>请填写整数</font>
                </div>
            </li>            
        	<li>
        		<div class="detail_1">产品价格和单位</div>
        		<div class="detail_2">
            		<input id="price" name="productDTO.price" />
            		<select id="unit" class="select" name="productDTO.unit">
            			<s:iterator value="unitlist" var="unit">
            				<option value="" selected></option>
            				<option value="<s:property value="#unit.typeCode"/>" ><s:property value="#unit.typeName"/></option>
            			</s:iterator>
            		</select>
                    <font color="#FF0000">* 数字请填写到小数点后一位，RMB</font>
				</div>
        	</li>
            <li>
                <div class="detail_1">产品类别</div>
                <div class="detail_2">
                    <select id="pro_category" class="select" name="productDTO.prodType">
                    	<s:iterator value="sortList" var="sort">
                    		<option value="" selected></option>                        	
                    		<option value="<s:property value="#sort.typeCode" />"  ><s:property value="#sort.typeName"/></option>
                        </s:iterator>
                    </select>
                    <font color="#FF0000">*</font>
                </div>           	
            </li>
            <li>
                <div class="detail_1">原产地</div>
                <div class="detail_2">
                    <select id="province" class="select" name="productDTO.province"></select>
                    <select id="city" class="select" name="productDTO.city"></select>
                    <select id="county" class="select" name="productDTO.country"></select>           	          
                    <input id="countrySide" name="productDTO.street" maxlength="20" value="乡镇、农村" />
                    <font color="#FF0000">*</font>
                 </div>    	
            </li>          
            <li>
                <div class="detail_1">产品信息过期日期</div>
                <div class="detail_2">
                	<input class="Wdate" id="end_date" name="productDTO.endDate" onClick="WdatePicker()" />
                    <font color="#FF0000">*</font>
                </div>
                
            </li>
            <li>
                <div class="detail_1">发布类型</div>
                <div class="detail_2">
                    <select id="pro_type" class="select" name="productDTO.infoCategory">
						<option value="" selected></option>
						<option value="1">出售</option>
						<option value="2" selected>采购</option>
                    </select>
                    <font color="#FF0000">*</font>
                </div>
            </li>
            <li class="supliy">
                <div class="detail_1">质量说明</div>
                <div class="detail_2">
                	<textarea id="supliy" name="productDTO.qualityDesc"></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人名称</div>
                <div class="detail_2">
                	<input id="contact" value="联系人" name="productDTO.contactName"  />
                	<font color="#FF0000">*</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人手机</div>
                <div class="detail_2">
                	<input id="mobile" name="productDTO.contactMobile"  />
                    <font color="#FF0000">*</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人电话</div>
                <div class="detail_2">
                	<input id="tel" name="productDTO.contactTel" />
                </div>
            </li>
            <li>
                <div class="detail_1">上传产品图片</div>
                <div class="detail_2">      	
                	<input type="file" name="myFile" id="pic"  accept="image/gif, image/jpeg"/><font color="red">图片规格：不大于100KB，200X200的jpg或gif格式图片</font>
                </div>
            </li>   
            <li class="detail">
                <textarea name="productDTO.prodDesc" id="detail"></textarea>   
            </li>              
            <li>
				<div class="detail_1"></div>
                <div class="detail_2">
                	<input id="submit" type="submit" value="确认" />
                	<input type="submit" value="重置" />
                </div>
            </li>      
		</div>     
    </div>
    </form>
	</s:if>
	<s:elseif test="urlMark == 2">
	<form action="${ctx}/my/updateProduct" method="post" enctype ="multipart/form-data">
	<div class="container">
		<div class="title">
        	<div class="ctrl">发布产品信息</div>
        </div> 
        <div class="info">
        	<li>
				<div class="detail_1">产品标题</div>
                <div class="detail_2">
                	<input id="product_name" maxlength="32" name="productDTO.prodName" value="<s:property value="product.prodName" />" /><font color="#FF0000">* 标题不超过32个字</font>
                </div>
            </li>
        	<li class="summary">
				<div class="detail_1">产品简要描述</div>
                <div class="detail_2">
                	<textarea id="summary" name="productDTO.summary"><s:property value="product.summary" /></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
        	<li class="guige">
				<div class="detail_1">产品规格描述</div>
                <div class="detail_2">
                	<textarea id="guige" name="productDTO.standardDesc"><s:property value="product.standardDesc" /></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
        	<li>
				<div class="detail_1">品牌名称</div>
                <div class="detail_2">
                	<input id="brand_change" name="brand" checked  type="radio" onClick="inputBrand('brand_2','brand_1')"/>从列表中选择：
                	<select id="brand_1" name="productDTO.brand" >
                		<s:iterator value="brandList" var="brand">
                			<s:if test=" product.brand == #brand.typeCode">
                				<option value="<s:property value="#brand.typeCode"/>" selected><s:property value="#brand.typeName"/></option>
                			</s:if>
                			<s:else>
                    			<option value="<s:property value="#brand.typeCode"/>"><s:property value="#brand.typeName"/></option>
                    		</s:else>
                    	</s:iterator>
                    </select>
                    <input type="radio" name="brand"  onClick="inputBrand('brand_1','brand_2')"/>其他：
                	<input id="brand_2" name="productDTO.brand" disabled maxlength="10"/> <font color="#FF0000">* 品牌名称不超过10个字</font>
                </div>
            </li>            
        	<li>
				<div class="detail_1">总量</div>
                <div class="detail_2">
                	<input id="amount" name="productDTO.amount" value="<s:property value="product.amount" />"/>
                    <font>请填写整数</font>
                </div>
            </li>            
        	<li>
        		<div class="detail_1">产品价格和单位</div>
        		<div class="detail_2">
            		<input id="price" name="productDTO.price" value="<s:property value="product.price" />"/>
            		<select id="unit" class="select" name="productDTO.unit">
            			<s:iterator value="unitlist" var="unit">
            				<s:if test=" product.unit == #unit.typeCode">
            					<option value="<s:property value="#unit.typeCode"/>" selected><s:property value="#unit.typeName"/></option>
            				</s:if>
            				<s:else>
            					<option value="<s:property value="#unit.typeCode"/>" ><s:property value="#unit.typeName"/></option>
            				</s:else>
            			</s:iterator>
            		</select>
                    <font color="#FF0000">* 数字请填写到小数点后一位，RMB</font>
				</div>
        	</li>
            <li>
                <div class="detail_1">产品类别</div>
                <div class="detail_2">
                    <select id="pro_category" class="select" name="productDTO.prodType">
                    	<s:iterator value="sortList" var="sort">                        	
                        	<s:if test="#sort.levels == 1">
                				<option value="<s:property value="#sort.typeCode" />"  disabled>----<s:property value="#sort.typeName"/></option>
                			</s:if>
                    		<s:elseif test=" #sort.levels == 2">
                    			<option value="<s:property value="#sort.typeCode" />"  disabled>--<s:property value="#sort.typeName"/></option>
                    		</s:elseif>
                    		<s:else>
                    			<s:if test=" product.prodType == #sort.typeCode">
                    				<option value="<s:property value="#sort.typeCode" />"  selected><s:property value="#sort.typeName"/></option>
                    			</s:if>
                    			<s:else>
                    				<option value="<s:property value="#sort.typeCode" />"  ><s:property value="#sort.typeName"/></option>
                    			</s:else>
                    		</s:else>
                        </s:iterator>
                    </select>
                    <font color="#FF0000">*</font>
                </div>           	
            </li>
            <li>
                <div class="detail_1">原产地</div>
                <div class="detail_2">
                    <select id="province" class="select" name="productDTO.province"></select>
                    <select id="city" class="select" name="productDTO.city"></select>
                    <select id="county" class="select" name="productDTO.country"></select>           	          
                    <input id="countrySide" name="productDTO.street" maxlength="20" value="乡镇、农村" />
                    <font color="#FF0000">*</font>
                 </div>    	
            </li>
            <s:if test="product.prodPlace != null">
             <li>
                <div class="detail_1">当前地址</div>
                <div class="detail_2">
						<s:property value="product.prodPlace"/>
                 </div>    	
            </li>           
            </s:if>          
            <li>
                <div class="detail_1">产品信息过期日期</div>
                <div class="detail_2">
                	<input class="Wdate" id="end_date" name="productDTO.endDate" onClick="WdatePicker()" value="<s:property value="product.endDate"/>">
                    <font color="#FF0000">*</font>
                </div>
                
            </li>
            <li>
                <div class="detail_1">发布类型</div>
                <div class="detail_2">
                    <select id="pro_type" class="select" name="productDTO.infoCategory">
	                    <s:if test=" product.infoCategory == 2 ">
	                        <option value="1">出售</option>
	                        <option value="2" selected>采购</option>
	                    </s:if>
	                    <s:else>
	                    	<option value="1" selected>出售</option>
	                        <option value="2">采购</option>
	                    </s:else>
                    </select>
                    <font color="#FF0000">*</font>
                </div>
            </li>
            <li class="supliy">
                <div class="detail_1">质量说明</div>
                <div class="detail_2">
                	<textarea id="supliy" name="productDTO.qualityDesc"><s:property value="product.qualityDesc"/></textarea>
                    <font>255个字以内</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人名称</div>
                <div class="detail_2">
                	<input id="contact" value="联系人" name="productDTO.contactName" value="<s:property value="product.contactName"/>" />
                	<font color="#FF0000">*</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人手机</div>
                <div class="detail_2">
                	<input id="mobile" name="productDTO.contactMobile" value="<s:property value="product.contactMobile"/>" />
                    <font color="#FF0000">*</font>
                </div>
            </li>
            <li>
                <div class="detail_1">联系人电话</div>
                <div class="detail_2">
                	<input id="tel" name="productDTO.contactTel" value="<s:property value="product.contactTel"/>"/>
                </div>
            </li>
            <li>
                <div class="detail_1">上传产品图片</div>
                <div class="detail_2">      	
                	<input type="file" name="myFile" id="pic"  accept="image/gif, image/jpeg"/><font color="red">图片规格：不大于100KB，200X200的jpg或gif格式图片</font>
                </div>
            </li>   
            <li class="detail">
                <textarea name="productDTO.prodDesc" id="detail"><s:property value="%{product.prodDesc}"  escape="false"/></textarea>   
            </li>              
            <li>
				<div class="detail_1"></div>
                <div class="detail_2">
                	<input id="submit" type="submit" value="确认" />
                	<input type="submit" value="重置" />
                </div>
            </li>      
		</div>     
    </div>
    </form>
    </s:elseif>
    <s:else>
    	未指定需要执行的操作是添加还是更新！请给urlMark赋值 1：插入 2：更新
    </s:else>
    <script type="application/javascript">
		setup()
    </script>
</body>
</html>
